import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  mode: 'history',
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home/page'
    },
    {
      path: '/home',
      name: 'home',
      component: HomeView,
      children: [
        {
          path: 'page',
          component: () => import('@/components/home/HomePage.vue')
        },
        {
          path: 'list',
          component: () => import('@/components/user/UserList.vue')
        },
        {
          path: 'about',
          component: () => import('@/components/user/UserAbout.vue')
        },
        {
          path: 'news',
          component: () => import('@/components/user/UserNews.vue')
        }
      ]
    },
    {
      path: '/404',
      component: () => import('@/views/404.vue')
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/404',
      hidden: true
    }
  ]
})

export default router
